package com.lzw.breezeNovel.model.enums.novel;


/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.model.enums
 * @date 2025/3/3
 * @description 小说的状态
 */
@SuppressWarnings("all")
public enum BookStatus {
    //连载
    SERIAL(0,"连载"),
    //完结
    FINISH(1,"完结"),
    //断更
    STOP(2,"断更");
    private Integer code;
    private String desc;

    BookStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    public Integer getCode() {
        return code;
    }

    /**
     * 根据code获取desc
     * @param code
     * @return
     */
    public static String getDescByCode(Integer code){
        String desc = null;
        for(var bookStatus : BookStatus.values()){
            if(bookStatus.getCode().equals(code)){
                desc =  bookStatus.desc;
                break;
            }
        }
        return desc;
    }
}
